<?php


namespace Hlcreation\Services;
use Hlcreation\Basic\Helper;
use App\Exceptions\ApiException as HOException;
class CloudLogServices
{
    /**
     * 电子合同操作日志
     * @param unknown $arr
     * @return boolean
     */

    public static function  logList($arr)
    {
        $url = config('contract.domain_name.url_log_api');
        return self::DataProcessing($url,$arr);
    }



    /**
     * 数据处理
     * @param unknown $url
     * @param unknown $arr
     * @throws HOException
     * @return boolean
     */
    private static function  DataProcessing($url,$arr){
        try {
            $arr_json= json_encode($arr);

            $arr_encode=base64_encode($arr_json);

            $data=Helper::httpPost($url,$arr_encode);

            if(isset($data['code'])){
                if($data['code']==200){
                    return $data;
                }else{
                    throw new HOException($data['msg']);
                }
            }else{

                throw new HOException('电子合同平台接口异常');
            }
        } catch (\Exception $e) {
            throw new HOException($e->getMessage());
        }
    }



}
